package com.diankangwo.factory.service.impl;

import com.diankangwo.factory.dao.TdUserinfoMapper;
import com.diankangwo.factory.entity.TdUserinfo;
import com.diankangwo.factory.service.TdUserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/** 会员接口实现类
 * Created by wuye on 2017/9/15.
 */
@Service("TdUserInfoService")
public class TdUserInfoServiceImpl implements TdUserInfoService{

    @Autowired
    private TdUserinfoMapper mapper;

    /**
     * 根据条件获取会员列表
     * @param map
     * @return
     */
    @Override
    public List<TdUserinfo> queryList(Map<String, Object> map) {
        return mapper.queryList(map);
    }

    /**
     * 根据条件获取端口会员列表
     * @param map
     * @return
     */
    @Override
    public List<TdUserinfo> queryList3(Map<String, Object> map) {
        return mapper.queryList3(map);
    }

    /**
     * 根据条件获取会员总数
     * @param map
     * @return
     */
    @Override
    public int queryTotal(Map<String, Object> map) {
        return mapper.queryTotal(map);
    }

    /**
     * 根据条件获取端口会员总数
     * @param map
     * @return
     */
    @Override
    public int queryTotal3(Map<String, Object> map) {
        return mapper.queryTotal3(map);
    }

    /**
     * 根据ID获取会员信息
     * @param id
     * @return
     */
    @Override
    public TdUserinfo queryById(int id) {
        return mapper.selectByPrimaryKey(id);
    }

    /**
     * 添加会员
     * @param tdUserinfo
     */
    @Override
    @Transactional
    public void save(TdUserinfo tdUserinfo) {
        mapper.insert(tdUserinfo);
    }

    /**
     * 修改会员
     * @param tdUserinfo
     * @return
     */
    @Override
    @Transactional
    public int update(TdUserinfo tdUserinfo) {
        return mapper.updateByPrimaryKey(tdUserinfo);
    }

    /**
     * 删除会员信息
     * @param id
     */
    @Override
    @Transactional
    public void delete(int id) {
        mapper.deleteByPrimaryKey(id);
    }

    @Override
    public TdUserinfo selectByPhone(String phone) {
        return mapper.selectByPhone(phone);
    }

    @Override
    public List<TdUserinfo> queryByDay(String startTime, String endTime) {
        return mapper.queryByDay(startTime,endTime);
    }

    @Override
    public List<TdUserinfo> queryByParentId2(int parentId) {
        return mapper.queryByParentId2(parentId);
    }

    @Override
    public List<TdUserinfo> queryByParentId(Map<String,Object> map) {
        return mapper.queryByParentId(map);
    }

    @Override
    public int queryTotal2(Map<String, Object> map) {
        return mapper.queryTotal2(map);
    }

    @Override
    public List<TdUserinfo> queryListUser(Map<String, Object> map) {
        return mapper.queryListUser(map);
    }

    @Override
    public TdUserinfo selectByUid(String uid) {
        return mapper.selectByUid(uid);
    }
}
